Remove conditionally-compiled code for Linux 2.4.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 18 Nov 2005 12:46:18 +0000 (13:46 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 18 Nov 2005 12:46:18 +0000 (13:46 +0100)
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
linux-2.6-xen-sparse/drivers/xen/console/console.c
linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h

index 9c8129be20d82bfe6b2113f35b38aa850298657c..05d16638aba7c7d27d266f6ce2411be9c5427b87 100644 (file)
 #include <asm-xen/balloon.h>
 #include <asm-xen/xen-public/memory.h>
 #include <linux/module.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #include <linux/percpu.h>
 #include <asm/tlbflush.h>
-#endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#define pte_offset_kernel pte_offset
-#define pud_t pgd_t
-#define pud_offset(d, va) d
-#elif defined(CONFIG_X86_64)
+#ifdef CONFIG_X86_64
 #define pmd_val_ma(v) (v).pmd
 #else
 #ifdef CONFIG_X86_PAE
index 0f516e5373b5501b0693aac55225a5a5abab5239..c5ddef540b59c881a65d35babb69888844f0bcf9 100644 (file)
@@ -121,11 +121,7 @@ static void init_evtchn_cpu_bindings(void)
 
 /* Upcall to generic IRQ layer. */
 #ifdef CONFIG_X86
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
 extern fastcall unsigned int do_IRQ(struct pt_regs *regs);
-#else
-extern asmlinkage unsigned int do_IRQ(struct pt_regs *regs);
-#endif
 #if defined (__i386__)
 #define IRQ_REG orig_eax
 #elif defined (__x86_64__)
index 2367594baa5d0a0521ca25bf36da89ca6cd1fbe2..15d18e917e2c60a9a21f52b6ed60b68942f90de5 100644 (file)
@@ -91,7 +91,6 @@ static void balloon_process(void *unused);
 static DECLARE_WORK(balloon_worker, balloon_process, NULL);
 static struct timer_list balloon_timer;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /* Use the private and mapping fields of struct page as a list. */
 #define PAGE_TO_LIST(p) ((struct list_head *)&p->private)
 #define LIST_TO_PAGE(l)                                \
@@ -102,19 +101,6 @@ static struct timer_list balloon_timer;
                p->mapping = NULL;              \
                p->private = 0;                 \
        } while(0)
-#else
-/* There's a dedicated list field in struct page we can use.    */
-#define PAGE_TO_LIST(p) ( &p->list )
-#define LIST_TO_PAGE(l) ( list_entry(l, struct page, list) )
-#define UNLIST_PAGE(p)  ( list_del(&p->list) )
-#define pte_offset_kernel pte_offset
-#define pud_t pgd_t
-#define pud_offset(d, va) d
-#define pud_none(d) 0
-#define pud_bad(d) 0
-#define subsys_initcall(_fn) __initcall(_fn)
-#define pfn_to_page(_pfn) (mem_map + (_pfn))
-#endif
 
 #define IPRINTK(fmt, args...) \
        printk(KERN_INFO "xen_mem: " fmt, ##args)
index a9f72453a67a3660acdc88dc4f6f1c8779a67e04..7ba0fed9ed32e9dcc54360a00aa34669b6b275c8 100644 (file)
@@ -128,12 +128,7 @@ static spinlock_t xencons_lock = SPIN_LOCK_UNLOCKED;
 /* Common transmit-kick routine. */
 static void __xencons_tx_flush(void);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static struct tty_driver *xencons_driver;
-#else
-static struct tty_driver xencons_driver;
-#endif
-
 
 /******************** Kernel console driver ********************************/
 
@@ -170,18 +165,11 @@ static void kcons_write_dom0(
        }
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static struct tty_driver *kcons_device(struct console *c, int *index)
 {
        *index = c->index;
        return xencons_driver;
 }
-#else
-static kdev_t kcons_device(struct console *c)
-{
-       return MKDEV(TTY_MAJOR, (xc_mode == XC_SERIAL) ? 64 : 1);
-}
-#endif
 
 static struct console kcons_info = {
        .device = kcons_device,
@@ -189,13 +177,8 @@ static struct console kcons_info = {
        .index  = -1,
 };
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #define __RETCODE 0
 static int __init xen_console_init(void)
-#else
-#define __RETCODE
-void xen_console_init(void)
-#endif
 {
        if (xen_init() < 0)
                return __RETCODE;
@@ -204,10 +187,8 @@ void xen_console_init(void)
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_SERIAL;
                kcons_info.write = kcons_write_dom0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
                if (xc_mode == XC_SERIAL)
                        kcons_info.flags |= CON_ENABLED;
-#endif
        } else {
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_TTY;
@@ -237,9 +218,7 @@ void xen_console_init(void)
 
        return __RETCODE;
 }
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 console_initcall(xen_console_init);
-#endif
 
 /*** Useful function for console debugging -- goes straight to Xen. ***/
 asmlinkage int xprintk(const char *fmt, ...)
@@ -283,15 +262,8 @@ void xencons_force_flush(void)
 
 /******************** User-space console driver (/dev/console) ************/
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #define DRV(_d)         (_d)
 #define TTY_INDEX(_tty) ((_tty)->index)
-#else
-static int xencons_refcount;
-static struct tty_struct *xencons_table[MAX_NR_CONSOLES];
-#define DRV(_d)         (&(_d))
-#define TTY_INDEX(_tty) (MINOR((_tty)->device) - xencons_driver.minor_start)
-#endif
 
 static struct termios *xencons_termios[MAX_NR_CONSOLES];
 static struct termios *xencons_termios_locked[MAX_NR_CONSOLES];
@@ -484,7 +456,6 @@ static inline int __xencons_put_char(int ch)
        return 1;
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static int xencons_write(
        struct tty_struct *tty,
        const unsigned char *buf,
@@ -509,42 +480,6 @@ static int xencons_write(
 
        return i;
 }
-#else
-static int xencons_write(
-       struct tty_struct *tty, 
-       int from_user,
-       const u_char *buf, 
-       int count)
-{
-       int i;
-       unsigned long flags;
-
-       if (from_user && verify_area(VERIFY_READ, buf, count))
-               return -EINVAL;
-
-       if (TTY_INDEX(tty) != 0)
-               return count;
-
-       spin_lock_irqsave(&xencons_lock, flags);
-
-       for (i = 0; i < count; i++) {
-               char ch;
-               if (from_user)
-                       __get_user(ch, buf + i);
-               else
-                       ch = buf[i];
-               if (!__xencons_put_char(ch))
-                       break;
-       }
-
-       if (i != 0)
-               __xencons_tx_flush();
-
-       spin_unlock_irqrestore(&xencons_lock, flags);
-
-       return i;
-}
-#endif
 
 static void xencons_put_char(struct tty_struct *tty, u_char ch)
 {
@@ -629,7 +564,6 @@ static void xencons_close(struct tty_struct *tty, struct file *filp)
        }
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static struct tty_operations xencons_ops = {
        .open = xencons_open,
        .close = xencons_close,
@@ -685,7 +619,6 @@ const struct consw xennull_con = {
        .con_scrolldelta =      DUMMY,
 };
 #endif
-#endif
 
 static int __init xencons_init(void)
 {
@@ -699,19 +632,10 @@ static int __init xencons_init(void)
 
        xencons_ring_init();
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ? 
                                          1 : MAX_NR_CONSOLES);
        if (xencons_driver == NULL)
                return -ENOMEM;
-#else
-       memset(&xencons_driver, 0, sizeof(struct tty_driver));
-       xencons_driver.magic       = TTY_DRIVER_MAGIC;
-       xencons_driver.refcount    = &xencons_refcount;
-       xencons_driver.table       = xencons_table;
-       xencons_driver.num         =
-               (xc_mode == XC_SERIAL) ? 1 : MAX_NR_CONSOLES;
-#endif
 
        DRV(xencons_driver)->major           = TTY_MAJOR;
        DRV(xencons_driver)->type            = TTY_DRIVER_TYPE_SERIAL;
@@ -735,37 +659,18 @@ static int __init xencons_init(void)
                DRV(xencons_driver)->name_base   = xc_num;
        }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        tty_set_operations(xencons_driver, &xencons_ops);
-#else
-       xencons_driver.open            = xencons_open;
-       xencons_driver.close           = xencons_close;
-       xencons_driver.write           = xencons_write;
-       xencons_driver.write_room      = xencons_write_room;
-       xencons_driver.put_char        = xencons_put_char;
-       xencons_driver.flush_chars     = xencons_flush_chars;
-       xencons_driver.chars_in_buffer = xencons_chars_in_buffer;
-       xencons_driver.send_xchar      = xencons_send_xchar;
-       xencons_driver.flush_buffer    = xencons_flush_buffer;
-       xencons_driver.throttle        = xencons_throttle;
-       xencons_driver.unthrottle      = xencons_unthrottle;
-       xencons_driver.wait_until_sent = xencons_wait_until_sent;
-#endif
 
        if ((rc = tty_register_driver(DRV(xencons_driver))) != 0) {
                printk("WARNING: Failed to register Xen virtual "
                       "console driver as '%s%d'\n",
                       DRV(xencons_driver)->name, DRV(xencons_driver)->name_base);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
                put_tty_driver(xencons_driver);
                xencons_driver = NULL;
-#endif
                return rc;
        }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        tty_register_device(xencons_driver, 0, NULL);
-#endif
 
        if (xen_start_info->flags & SIF_INITDOMAIN) {
                xencons_priv_irq = bind_virq_to_irqhandler(
index 42f4a8f70a680d53eb84310a50f33b566b1bb68a..85c65e95a8b4c70bd74e7b4f1eca6da5f7c9b8a5 100644 (file)
@@ -436,9 +436,7 @@ static struct miscdevice evtchn_miscdev = {
        .minor        = EVTCHN_MINOR,
        .name         = "evtchn",
        .fops         = &evtchn_fops,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
        .devfs_name   = "misc/evtchn",
-#endif
 };
 
 static int __init evtchn_init(void)
index 5239a18fc60645e4be0444aff939f732ad90d299..cf0c0eb7d70917dc8d108fa3d20973ca04d808f6 100644 (file)
 #include <asm-xen/xen-public/dom0_ops.h>
 #include <asm-xen/xen_proc.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#define pud_t pgd_t
-#define pud_offset(d, va) d
-#endif
-
 static struct proc_dir_entry *privcmd_intf;
 
 static int privcmd_ioctl(struct inode *inode, struct file *file,
index 09517d24ae38ce6acea6c0fd0a38c4f701669853..899734e1fba50a9e06d60f014682f28f560f9b3b 100644 (file)
 #include <asm/ptrace.h>
 #include <asm/page.h>
 #if defined(__i386__)
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #  ifdef CONFIG_X86_PAE
 #   include <asm-generic/pgtable-nopud.h>
 #  else
 #   include <asm-generic/pgtable-nopmd.h>
 #  endif
-# else
-#  define pud_t pgd_t
-# endif
 #endif
 
 extern shared_info_t *HYPERVISOR_shared_info;
@@ -113,22 +109,6 @@ void xen_tlb_flush_mask(cpumask_t *mask);
 void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr);
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-/* 
-** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 
-** include sufficient #defines to allow the below to build. 
-*/
-#define DEFINE_PER_CPU(type, name) \
-    __typeof__(type) per_cpu__##name
-
-#define per_cpu(var, cpu)           (*((void)cpu, &per_cpu__##var))
-#define __get_cpu_var(var)          per_cpu__##var
-#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
-
-#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
-#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
-#endif /* linux < 2.6.0 */
-
 /* Returns zero on success else negative errno. */
 int xen_create_contiguous_region(
     unsigned long vstart, unsigned int order, unsigned int address_bits);